package com.server.game.hash;

import java.util.HashMap;
import java.util.Map;

import com.sandking.tools.SK_Random;

public class Cache {
	static Map<Integer, Integer> hashMap = new HashMap<Integer, Integer>();
	public static void main(String[] args) {
		System.out.println(Math.pow(2, 6));
		for (int i = 0; i < 10000; i++) {
			int index = (64 - 1) & hash(SK_Random.randomString(32, SK_Random.E62));
			Integer count =  hashMap.get(index);
			if (count == null) {
				count = 0;
			}
			count++;
			hashMap.put(index, count);
		}
		System.out.println(hashMap);
		System.out.println(hashMap.size());
	}

	public static int hash(Object k) {
		int h = 0;
		h ^= k.hashCode();
		h += (h << 15) ^ 0xffffcd7d;
		h ^= (h >>> 10);
		h += (h << 3);
		h ^= (h >>> 6);
		h += (h << 2) + (h << 14);
		return h ^ (h >>> 16);
	}
}
